import { Button } from "antd";
import axios from "axios";
import React, { useEffect } from "react";
import "./App.css";
import Index from "./components/hotItem/index";
import { http } from "./main/global";

window.http = http;
const api = () => {
  axios
    .get("http://localhost:3000/users/find")
    .then((res) => {
      console.log(res.data);
    })
    .catch((err) => {
      console.error(err);
    });
};

const App = () => {
  useEffect(() => {
    http({
      path: "https://cnodejs.org/api/v1/topics",
      method: "get",
      params: {},
    }).then((res) => {
      console.log(res);
    });
  });
  return (
    <div className="App">
      <Button type="primary" onClick={api}>
        Button
      </Button>
      <Index />
    </div>
  );
};

export default App;
